﻿CREATE TABLE [dbo].[BlankettPost] (
    [Id]         UNIQUEIDENTIFIER NOT NULL,
    [ValId]      UNIQUEIDENTIFIER NOT NULL,
    [BlankettId] UNIQUEIDENTIFIER NOT NULL,
    [PersonId]   UNIQUEIDENTIFIER NULL,
    [Andrad]     DATETIME         NULL,
    [Skapad]     DATETIME         NOT NULL,
    [Status]     NVARCHAR (50)    NULL,
    [Motivering] TEXT             NULL,
    CONSTRAINT [PK_BlankettPost] PRIMARY KEY CLUSTERED ([Id] ASC, [ValId] ASC),
    CONSTRAINT [FK_BlankettPost_ToBlankett] FOREIGN KEY ([BlankettId], [ValId]) REFERENCES [dbo].[Blankett] ([Id], [ValId]),
    CONSTRAINT [FK_BlankettPost_ToPerson] FOREIGN KEY ([PersonId], [ValId]) REFERENCES [dbo].[Person] ([Id], [ValId])
);


